from datetime import timedelta

# The DAG object; we'll need this to instantiate a DAG
from airflow import DAG
# Operators; we need this to operate!
from airflow.operators.bash import BashOperator
from airflow.utils.dates import days_ago

# These args will get passed on to each operator
# You can override them on a per-task basis during operator initialization
default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'email': ['airflow@example.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),

}
dag = DAG(
    'example_dag',
    default_args=default_args,
    description='A simple DAG',
    schedule_interval=timedelta(days=1),
    start_date=days_ago(2),
    tags=['example'],
)

t1 = BashOperator(
    task_id='t1',
    bash_command='sleep 5',
    dag=dag,
)

t2 = BashOperator(
    task_id='t2',
    depends_on_past=False,
    bash_command='sleep 180',
    retries=3,
    dag=dag,
)

t3 = BashOperator(
    task_id='t3',
    depends_on_past=False,
    bash_command='sleep 90',
    retries=3,
    dag=dag,
)

t1 >> [t2, t3]
